
#ifndef IRIDE_GEOMETRY_H_
#define IRIDE_GEOMETRY_H_

#include "Types.h"

namespace Iride
{
	namespace Geometry
	{
		// 8 vertices
		void cube(Real edgeLength, Vector3* vertices, Uint* indices)
		{
			Real halfEdge = edgeLength / 2.0f;

			vertices[0].x = -halfEdge;	// Front top left
			vertices[0].y = +halfEdge;
			vertices[0].z = +halfEdge;

			vertices[1].x = +halfEdge;	// Front top right
			vertices[1].y = +halfEdge;
			vertices[1].z = +halfEdge;

			vertices[2].x = -halfEdge;	// Front bottom left
			vertices[2].y = -halfEdge;
			vertices[2].z = +halfEdge;

			vertices[3].x = +halfEdge;	// Front bottom right
			vertices[3].y = -halfEdge;
			vertices[3].z = +halfEdge;

			vertices[4].x = -halfEdge;	// Back top left
			vertices[4].y = +halfEdge;
			vertices[4].z = -halfEdge;

			vertices[5].x = +halfEdge;	// Back top right
			vertices[5].y = +halfEdge;
			vertices[5].z = -halfEdge;

			vertices[6].x = -halfEdge;	// Back bottom left
			vertices[6].y = -halfEdge;
			vertices[6].z = -halfEdge;

			vertices[7].x = +halfEdge;	// Back bottom right
			vertices[7].y = -halfEdge;
			vertices[7].z = -halfEdge;

			Uint cubeInd[] = {0,2,3, 0,3,1,  1,3,7, 1,7,5,  5,7,6, 5,6,4,  4,6,2, 4,2,0,  4,0,1, 4,1,5, 2,6,7, 2,7,3};

			for( Uint i=0; i < 36; i++)
			{
				indices[i] = cubeInd[i];
			}
		}
	};
};

#endif
